using System;
using System.ComponentModel.DataAnnotations;
using InfoTech.VinhSon.Bussiness;

namespace InfoTech.VinhSon.Models
{
	[Serializable]
	public partial class GroupModel
	{

		#region Constructor

		public GroupModel()
		{
		}

		public GroupModel(Group value)
		{
			Id = value.Id;
			Name = value.Name;
			Description = value.Description;
			if(value.Layout != null)
				LayoutId = value.Layout.Id;
			Priority = value.Priority;
			Index = value.Index ?? false;
			HomePage = value.HomePage ?? false;
			CategoryPage = value.CategoryPage ?? false;
			ArticlePage = value.ArticlePage ?? false;
			NoArticle = value.NoArticle ?? false;
			FilterByDate = value.FilterByDate ?? false;
			TopArticle = value.TopArticle;
			Activated = value.Activated ?? false;
            FromDate = value.FromDate;
            ToDate = value.ToDate;
		}

		#endregion

		#region Fields

		private System.Int32 _Id;

		private System.String _Name;

		private System.String _Description;

		private System.Int32? _LayoutId;

		private System.Int32? _Priority;

		private System.Boolean _Index;

		private System.Boolean _HomePage;

		private System.Boolean _CategoryPage;

		private System.Boolean _ArticlePage;

		private System.Boolean _NoArticle;

		private System.Boolean _FilterByDate;

		private System.Int32? _TopArticle;

		private System.Boolean _Activated;

        private System.DateTime? _FromDate;

        private System.DateTime? _ToDate;

		#endregion

		#region Properties

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32 Id
		{
			get
			{
				return _Id;
			}
			set
			{
				_Id = value;
			}
		}

        [Required]
		//[Range(0, 0]
		[StringLength(500)]
		public System.String Name
		{
			get
			{
				return _Name;
			}
			set
			{
				_Name = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		[StringLength(500)]
		public System.String Description
		{
			get
			{
				return _Description;
			}
			set
			{
				_Description = value;
			}
		}

        [Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? LayoutId
		{
			get
			{
				return _LayoutId;
			}
			set
			{
				_LayoutId = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? Priority
		{
			get
			{
				return _Priority;
			}
			set
			{
				_Priority = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Index
		{
			get
			{
				return _Index;
			}
			set
			{
				_Index = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean HomePage
		{
			get
			{
				return _HomePage;
			}
			set
			{
				_HomePage = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean CategoryPage
		{
			get
			{
				return _CategoryPage;
			}
			set
			{
				_CategoryPage = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean ArticlePage
		{
			get
			{
				return _ArticlePage;
			}
			set
			{
				_ArticlePage = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean NoArticle
		{
			get
			{
				return _NoArticle;
			}
			set
			{
				_NoArticle = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean FilterByDate
		{
			get
			{
				return _FilterByDate;
			}
			set
			{
				_FilterByDate = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? TopArticle
		{
			get
			{
				return _TopArticle;
			}
			set
			{
				_TopArticle = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Activated
		{
			get
			{
				return _Activated;
			}
			set
			{
				_Activated = value;
			}
		}

        //[Required]
        //[Range(0, 0]
        //[StringLength(0)]
        public System.DateTime? FromDate
        {
            get
            {
                return _FromDate;
            }
            set
            {
                _FromDate = value;
            }
        }

        //[Required]
        //[Range(0, 0]
        //[StringLength(0)]
        public System.DateTime? ToDate
        {
            get
            {
                return _ToDate;
            }
            set
            {
                _ToDate = value;
            }
        }

		#endregion

		#region Operators

		public void Update(Group value)
		{
			// value.Id = Id;
			value.Name = Name;
			value.Description = Description;
			value.Priority = Priority;
			value.Index = Index;
			value.HomePage = HomePage;
			value.CategoryPage = CategoryPage;
			value.ArticlePage = ArticlePage;
			value.NoArticle = NoArticle;
			value.FilterByDate = FilterByDate;
			value.TopArticle = TopArticle;
			value.Activated = Activated;
            value.FromDate = FromDate;
            value.ToDate = ToDate;
		}

		public static implicit operator GroupModel(Group obj)
		{
			return new GroupModel(obj);
		}

		public static implicit operator Group(GroupModel obj)
		{
			Group value = new Group();
			obj.Update(value);
			return value;
		}

		#endregion

	}
}
